package com.wlz.demo;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;

/**
 * @author wlz
 * @date 2024-03-01  11:17
 */
public class CodeTest {
    public static void main(String[] args) {
        try {
            // 编码过的URL字符串
            String encodedUrl = "http://adu-caros-ota.bj.bcebos.com/ADCBD0701000001S005C041RT6.zip_1708583226/ADCBD0701000001S005C041RT6.zip?authorization=bce-auth-v1%2F37aa72978c7746e28869cf2035ceeb5c%2F2024-02-29T07%3A27%3A20Z%2F-1%2Fhost%2Fa55b3667e438abdea92197a589fa25f3b7ee641a54f789aaf46d4c93057d5d96";


            String encodedUrl2 = "http://adu-caros-ota.bj.bcebos.com/ADCBD0701000001S005C041RT6.zip_1708583226/ADCBD0701000001S005C041RT6.zip?authorization=bce-auth-v1/37aa72978c7746e28869cf2035ceeb5c/2024-02-29T07:27:20Z/-1/host/a55b3667e438abdea92197a589fa25f3b7ee641a54f789aaf46d4c93057d5d96";

            // 解码
            String decodedUrl = URLDecoder.decode(encodedUrl, StandardCharsets.UTF_8.toString());

            String decodedUrl2 = URLDecoder.decode(encodedUrl2, StandardCharsets.UTF_8.toString());

            // 输出解码后的URL
            System.out.println("Decoded URL: " + decodedUrl);
            System.out.println("Decoded2 URL: " + decodedUrl2);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

    }
}
